package com.yuandian.management.controller;

import com.yuandian.api.management.entity.CommonInterface;
import com.yuandian.bpm.common.core.util.R;
import com.yuandian.management.service.ICommonInterfaceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 说明：通用接口配置Controller
 * @Author zfsn
 * @Date 2023/2/21 9:38
 */
@RestController
@RequestMapping("/common/interface")
@Api(tags = "通用接口配置")
public class CommonInterfaceController {

	@Autowired
	private ICommonInterfaceService commonInterfaceService;

	/**
	 * 通过配置编码获取通用接口配置
	 * @param code 配置编码
	 * @return 通用返回对象
	 */
	@ApiOperation(value = "查询通用接口配置", notes = "通过配置编码获取通用接口配置")
	@GetMapping("/query/{code}")
	public R<CommonInterface> queryByCode(@PathVariable("code") String code) {
		return R.ok(commonInterfaceService.getByCode(code));
	}
}
